package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.annotation.RpcReference;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @RpcReference
    IUserService userService;

    @GetMapping("/getUserById")
    public User getUserById(int id) {
        User user = userService.getById(id);
        System.out.println(user.toString());
        return user;
    }

    @GetMapping("/getUser")
    public User getUser() {
        User user = new User();
        user.setId(99);
        user.setName("测试");
        return user;
    }
}
